import './WarningInfo.scss'
import { TextList001 } from '../Common/TextList'

import { useState } from 'react'
import { useMount, useRequest } from 'ahooks'
import { Http } from '../../../../Common/Api'
import { project } from '../../../../Common/Data'
const { imageUrl } = project[window.location.hostname]

export const WarningInfoA01 = () => {
    const Top = [
        { uuid: 1, label: '时间', value: 'attendanceTime', flex: 3 },
        { uuid: 2, label: '工区', value: 'organizationName', flex: 2 },
        { uuid: 3, label: '姓名', value: 'personName', flex: 2 },
        { uuid: 4, label: '位置', value: 'address', flex: 3 },
    ]
    const [Data, setData] = useState({ list: [], total: 0 })

    const { runAsync } = useRequest(Http, { manual: true, onSuccess: res => setData(res) })
    useMount(() => {
        runAsync({ url: 'getAttendance', data: { pageIndex: 1, pageSize: 20, OAttendanceTime: 'desc@1' } })
    })

    return (
        <div className="WarningInfoA01">
            <div className="warn">
                <img src={imageUrl + 'warning.png'} alt="" />
                <div>定位异常数</div>
                <div>{Data.total}</div>
            </div>
            <div className="list">
                <TextList001 Top={Top} data={Data.list} click={TextEvent} />
            </div>
        </div>
    )
}
